import { Vector3 } from "@minecraft/server";
import { CubeRegion } from "@sapi-game/gameRegion/gameRegion";
import { GameStructure } from "@sapi-game/main";
import { DimensionIds } from "@sapi-game/utils/vanila-data";

export interface DirtShopMap {
    name: string;
    /**房主出生点 */
    hostSpawnPoint: Vector3;
    /**进攻方出生点 */
    attackerSpawnPoint: Vector3;
    /**要加载的结构 */
    structures: GameStructure[];
    /**底座区域 */
    baseRegion: CubeRegion;
    /**游戏范围 */
    region: CubeRegion;
    /**加载时玩家的位置 */
    loadPos: Vector3;
    /**结束时进攻方位置 */
    attackerEndPos: Vector3;
    /**结束时房主的位置 */
    hostEndPos: Vector3;
    /**床的位置 */
    bedPos: {
        head: Vector3;
        tail: Vector3;
    };
}

const RegularMap: DirtShopMap = {
    name: "常规地图",
    loadPos: { x: 1920, y: -26, z: 1969 },
    attackerEndPos: { x: 1936, y: -26.0, z: 1967 },
    hostEndPos: { x: 1941.5, y: -25.0, z: 1966.5 },
    attackerSpawnPoint: { x: 1900, y: -60, z: 1966 },
    hostSpawnPoint: { x: 1936, y: -60, z: 1960 },
    region: new CubeRegion(
        DimensionIds.Overworld,
        { x: 1868, y: -64, z: 1920 },
        { x: 1970, y: -28, z: 2023 }
    ),
    bedPos: {
        head: { x: 1935, y: -60, z: 1973 },
        tail: { x: 1936, y: -60, z: 1973 },
    },
    structures: [
        new GameStructure("泥土商店_地图_常规_商店", {
            x: 1924,
            y: -64,
            z: 1941,
        }),
        new GameStructure("泥土商店_地图_常规_玩家房", {
            x: 1895,
            y: -61,
            z: 1962,
        }),
    ],
    baseRegion: new CubeRegion(
        DimensionIds.Overworld,
        { x: 1868, y: -64, z: 1920 },
        { x: 1970, y: -61, z: 2023 }
    ),
};

const MediumMap: DirtShopMap = {
    name: "中级地图",
    region: new CubeRegion(
        DimensionIds.Overworld,
        { x: 1867, y: -64, z: 2049 },
        { x: 1969, y: -28, z: 2152 }
    ),
    baseRegion: new CubeRegion(
        DimensionIds.Overworld,
        { x: 1969, y: -61, z: 2152 },
        { x: 1867, y: -64, z: 2049 }
    ),
    loadPos: { x: 1921.5, y: -26.0, z: 2096 },
    hostEndPos: { x: 1945.3, y: -26.0, z: 2095.3 },
    attackerEndPos: { x: 1938.5, y: -26.0, z: 2095.5 },
    attackerSpawnPoint: { x: 1899, y: -60, z: 2095 },
    bedPos: {
        head: { x: 1938, y: -55, z: 2106 },
        tail: { x: 1938, y: -55, z: 2105 },
    },
    hostSpawnPoint: { x: 1936.5, y: -55.0, z: 2090.5 },
    structures: [
        new GameStructure("泥土商店_地图_双层_商店", {
            x: 1921,
            y: -64,
            z: 2070,
        }),
        new GameStructure("泥土商店_地图_常规_玩家房", {
            x: 1894,
            y: -61,
            z: 2091,
        }),
    ],
};

export const DirtShopMaps: DirtShopMap[] = [RegularMap, MediumMap];
